diff options
-rw-r--r-- | core/input/input_event.cpp | 2 | ||||
-rw-r--r-- | doc/classes/EditorPlugin.xml | 18 | ||||
-rw-r--r-- | doc/classes/EditorResourcePicker.xml | 22 | ||||
-rw-r--r-- | editor/editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/editor_resource_picker.cpp | 12 | ||||
-rw-r--r-- | scene/2d/physical_bone_2d.h | 2 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 3 | ||||
-rw-r--r-- | scene/resources/tile_set.cpp | 2 |
8 files changed, 34 insertions, 29 deletions
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index 6f063c217f..9c1cf15342 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -1023,7 +1023,7 @@ static const char *_joy_button_descriptions[JOY_BUTTON_SDL_MAX] = { String InputEventJoypadButton::as_text() const { String text = "Joypad Button " + itos(button_index); - if (button_index < JOY_BUTTON_SDL_MAX) { + if (button_index >= 0 && button_index < JOY_BUTTON_SDL_MAX) { text += vformat(" (%s)", _joy_button_descriptions[button_index]); } diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 2736414cb1..0c0439e9d3 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -334,6 +334,15 @@ Restore the state saved by [method _get_state]. </description> </method> + <method name="_set_window_layout" qualifiers="virtual"> + <return type="void"> + </return> + <argument index="0" name="layout" type="ConfigFile"> + </argument> + <description> + Restore the plugin GUI layout saved by [method _get_window_layout]. + </description> + </method> <method name="add_autoload_singleton"> <return type="void"> </return> @@ -697,15 +706,6 @@ Use this method if you always want to receive inputs from 3D view screen inside [method _forward_spatial_gui_input]. It might be especially usable if your plugin will want to use raycast in the scene. </description> </method> - <method name="set_window_layout" qualifiers="virtual"> - <return type="void"> - </return> - <argument index="0" name="layout" type="ConfigFile"> - </argument> - <description> - Restore the plugin GUI layout saved by [method _get_window_layout]. - </description> - </method> <method name="update_overlays" qualifiers="const"> <return type="int"> </return> diff --git a/doc/classes/EditorResourcePicker.xml b/doc/classes/EditorResourcePicker.xml index 508b546ef3..0029955819 100644 --- a/doc/classes/EditorResourcePicker.xml +++ b/doc/classes/EditorResourcePicker.xml @@ -10,30 +10,30 @@ <tutorials> </tutorials> <methods> - <method name="get_allowed_types" qualifiers="const"> - <return type="PackedStringArray"> - </return> - <description> - Returns a list of all allowed types and subtypes corresponding to the [member base_type]. If the [member base_type] is empty, an empty list is returned. - </description> - </method> - <method name="handle_menu_selected" qualifiers="virtual"> + <method name="_handle_menu_selected" qualifiers="virtual"> <return type="void"> </return> <argument index="0" name="id" type="int"> </argument> <description> - This virtual method can be implemented to handle context menu items not handled by default. See [method set_create_options]. + This virtual method can be implemented to handle context menu items not handled by default. See [method _set_create_options]. </description> </method> - <method name="set_create_options" qualifiers="virtual"> + <method name="_set_create_options" qualifiers="virtual"> <return type="void"> </return> <argument index="0" name="menu_node" type="Object"> </argument> <description> This virtual method is called when updating the context menu of [EditorResourcePicker]. Implement this method to override the "New ..." items with your own options. [code]menu_node[/code] is a reference to the [PopupMenu] node. - [b]Note:[/b] Implement [method handle_menu_selected] to handle these custom items. + [b]Note:[/b] Implement [method _handle_menu_selected] to handle these custom items. + </description> + </method> + <method name="get_allowed_types" qualifiers="const"> + <return type="PackedStringArray"> + </return> + <description> + Returns a list of all allowed types and subtypes corresponding to the [member base_type]. If the [member base_type] is empty, an empty list is returned. </description> </method> <method name="set_toggle_pressed"> diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 091c5bea44..f2502b7e70 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -916,7 +916,7 @@ void EditorPlugin::_bind_methods() { BIND_VMETHOD(MethodInfo("_save_external_data")); BIND_VMETHOD(MethodInfo("_apply_changes")); BIND_VMETHOD(MethodInfo(Variant::PACKED_STRING_ARRAY, "_get_breakpoints")); - BIND_VMETHOD(MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); + BIND_VMETHOD(MethodInfo("_set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); BIND_VMETHOD(MethodInfo("_get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); BIND_VMETHOD(MethodInfo(Variant::BOOL, "_build")); BIND_VMETHOD(MethodInfo("_enable_plugin")); diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 495e43577c..1ea8c71f85 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -361,8 +361,8 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) { void EditorResourcePicker::set_create_options(Object *p_menu_node) { // If a subclass implements this method, use it to replace all create items. - if (get_script_instance() && get_script_instance()->has_method("set_create_options")) { - get_script_instance()->call("set_create_options", p_menu_node); + if (get_script_instance() && get_script_instance()->has_method("_set_create_options")) { + get_script_instance()->call("_set_create_options", p_menu_node); return; } @@ -418,8 +418,8 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) { } bool EditorResourcePicker::handle_menu_selected(int p_which) { - if (get_script_instance() && get_script_instance()->has_method("handle_menu_selected")) { - return get_script_instance()->call("handle_menu_selected", p_which); + if (get_script_instance() && get_script_instance()->has_method("_handle_menu_selected")) { + return get_script_instance()->call("_handle_menu_selected", p_which); } return false; @@ -640,8 +640,8 @@ void EditorResourcePicker::_bind_methods() { ClassDB::bind_method(D_METHOD("set_editable", "enable"), &EditorResourcePicker::set_editable); ClassDB::bind_method(D_METHOD("is_editable"), &EditorResourcePicker::is_editable); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_create_options", PropertyInfo(Variant::OBJECT, "menu_node"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("handle_menu_selected", PropertyInfo(Variant::INT, "id"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("_set_create_options", PropertyInfo(Variant::OBJECT, "menu_node"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("_handle_menu_selected", PropertyInfo(Variant::INT, "id"))); ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type"), "set_base_type", "get_base_type"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource", 0), "set_edited_resource", "get_edited_resource"); diff --git a/scene/2d/physical_bone_2d.h b/scene/2d/physical_bone_2d.h index d650a0426f..46a2772bad 100644 --- a/scene/2d/physical_bone_2d.h +++ b/scene/2d/physical_bone_2d.h @@ -44,7 +44,7 @@ protected: static void _bind_methods(); private: - Skeleton2D *parent_skeleton; + Skeleton2D *parent_skeleton = nullptr; int bone2d_index = -1; NodePath bone2d_nodepath; bool follow_bone_when_simulating = false; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 17c0023b09..5369792194 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2547,6 +2547,8 @@ void Viewport::_gui_remove_control(Control *p_control) { } Window *Viewport::get_base_window() const { + ERR_FAIL_COND_V(!is_inside_tree(), nullptr); + Viewport *v = const_cast<Viewport *>(this); Window *w = Object::cast_to<Window>(v); while (!w) { @@ -3336,6 +3338,7 @@ bool Viewport::is_input_handled() const { return local_input_handled; } else { const Viewport *vp = this; + ERR_FAIL_COND_V(!is_inside_tree(), false); while (true) { if (Object::cast_to<Window>(vp)) { break; diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 2220df06f6..0d6f3c07f0 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -2454,6 +2454,7 @@ int TileData::get_terrain_set() const { } void TileData::set_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit, int p_terrain_index) { + ERR_FAIL_INDEX(p_peering_bit, TileSet::CELL_NEIGHBOR_MAX); ERR_FAIL_COND(p_terrain_index < -1); if (tile_set) { ERR_FAIL_COND(p_terrain_index >= tile_set->get_terrains_count(terrain_set)); @@ -2464,6 +2465,7 @@ void TileData::set_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit, int } int TileData::get_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit) const { + ERR_FAIL_INDEX_V(p_peering_bit, TileSet::CELL_NEIGHBOR_MAX, -1); return terrain_peering_bits[p_peering_bit]; } |