diff options
-rw-r--r-- | doc/classes/Object.xml | 4 | ||||
-rw-r--r-- | doc/classes/RenderingDevice.xml | 9 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 3 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 70 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.h | 11 | ||||
-rw-r--r-- | scene/gui/tab_container.cpp | 27 | ||||
-rw-r--r-- | scene/gui/tab_container.h | 1 | ||||
-rw-r--r-- | servers/rendering/rendering_device.cpp | 1 |
10 files changed, 96 insertions, 41 deletions
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index b69326b6e0..c508591093 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -556,7 +556,7 @@ While all options have the same outcome ([code]button[/code]'s [signal BaseButton.button_down] signal will be connected to [code]_on_button_down[/code]), [b]option 3[/b] offers the best validation: it will print a compile-time error if either the [code]button_down[/code] [Signal] or the [code]_on_button_down[/code] [Callable] are not defined. On the other hand, [b]option 2[/b] only relies on string names and will only be able to validate either names at runtime: it will print a runtime error if [code]"button_down"[/code] doesn't correspond to a signal, or if [code]"_on_button_down"[/code] is not a registered method in the object [code]self[/code]. The main reason for using options 1, 2, or 4 would be if you actually need to use strings (e.g. to connect signals programmatically based on strings read from a configuration file). Otherwise, option 3 is the recommended (and fastest) method. [b]Binding and passing parameters:[/b] The syntax to bind parameters is through [method Callable.bind], which returns a copy of the [Callable] with its parameters bound. - When calling [method emit_signal], the signal parameters can be also passed. The examples below show the relationship between these signal parameters and bound parameters. + When calling [method emit_signal] or [method Signal.emit], the signal parameters can be also passed. The examples below show the relationship between these signal parameters and bound parameters. [codeblocks] [gdscript] func _ready(): @@ -566,7 +566,7 @@ player.hit.connect(_on_player_hit.bind("sword", 100)) # Parameters added when emitting the signal are passed first. - player.emit_signal("hit", "Dark lord", 5) + player.hit.emit("Dark lord", 5) # We pass two arguments when emitting (`hit_by`, `level`), # and bind two more arguments when connecting (`weapon_type`, `damage`). diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml index 36abde36b4..3c1061dee9 100644 --- a/doc/classes/RenderingDevice.xml +++ b/doc/classes/RenderingDevice.xml @@ -138,6 +138,15 @@ Submits the compute list for processing on the GPU. This is the compute equivalent to [method draw_list_draw]. </description> </method> + <method name="compute_list_dispatch_indirect"> + <return type="void" /> + <param index="0" name="compute_list" type="int" /> + <param index="1" name="buffer" type="RID" /> + <param index="2" name="offset" type="int" /> + <description> + Submits the compute list for processing on the GPU with the given group counts stored in the [param buffer] at [param offset]. Buffer must have been created with [constant STORAGE_BUFFER_USAGE_DISPATCH_INDIRECT] flag. + </description> + </method> <method name="compute_list_end"> <return type="void" /> <description> diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 4858fcf78f..ea364d8a0d 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2755,7 +2755,8 @@ void EditorPropertyNodePath::_node_assign() { Variant val = get_edited_property_value(); Node *n = nullptr; if (val.get_type() == Variant::Type::NODE_PATH) { - n = get_base_node()->get_node_or_null(val); + Node *base_node = get_base_node(); + n = base_node == nullptr ? nullptr : base_node->get_node_or_null(val); } else { n = Object::cast_to<Node>(val); } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 233f20a8b3..2087c8cee6 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2250,6 +2250,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected terminal_emulator_args.push_back("--working-directory"); } else if (chosen_terminal_emulator.ends_with("urxvt")) { terminal_emulator_args.push_back("-cd"); + } else if (chosen_terminal_emulator.ends_with("xfce4-terminal")) { + terminal_emulator_args.push_back("--working-directory"); } } #endif diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index d09e4fd3db..88250ea3c3 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -6639,8 +6639,13 @@ void fragment() { for (int j = 0; j < 4; j++) { Transform3D t = Transform3D(); - t = t.scaled(axis * distances[j + 1]); - t = t.translated(axis * distances[j]); + if (distances[j] > 0.0) { + t = t.scaled(axis * distances[j + 1]); + t = t.translated(axis * distances[j]); + } else { + t = t.scaled(axis * distances[j]); + t = t.translated(axis * distances[j + 1]); + } RenderingServer::get_singleton()->multimesh_instance_set_transform(origin_multimesh, i * 4 + j, t); RenderingServer::get_singleton()->multimesh_instance_set_color(origin_multimesh, i * 4 + j, origin_color); } diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 6c7a3f776e..9498e980ec 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -37,13 +37,16 @@ #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/themes/editor_scale.h" -#include "scene/gui/check_box.h" +#include "scene/2d/sprite_2d.h" +#include "scene/3d/sprite_3d.h" +#include "scene/gui/nine_patch_rect.h" #include "scene/gui/option_button.h" #include "scene/gui/panel_container.h" #include "scene/gui/separator.h" #include "scene/gui/spin_box.h" #include "scene/gui/view_panner.h" #include "scene/resources/atlas_texture.h" +#include "scene/resources/style_box_texture.h" Transform2D TextureRegionEditor::_get_offset_transform() const { Transform2D mtx; @@ -94,7 +97,7 @@ void TextureRegionEditor::_texture_overlay_draw() { last_cell = cell; } } else { - for (int i = 0; i < s.width; i++) { + for (int i = 0; i < s.width + snap_separation.x; i++) { int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(i, 0)).x - snap_offset.x) / (snap_step.x + snap_separation.x))); if (i == 0) { last_cell = cell; @@ -120,7 +123,7 @@ void TextureRegionEditor::_texture_overlay_draw() { last_cell = cell; } } else { - for (int i = 0; i < s.height; i++) { + for (int i = 0; i < s.height + snap_separation.y; i++) { int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(0, i)).y - snap_offset.y) / (snap_step.y + snap_separation.y))); if (i == 0) { last_cell = cell; @@ -281,6 +284,17 @@ void TextureRegionEditor::_draw_margin_line(Vector2 p_from, Vector2 p_to) { } } +void TextureRegionEditor::_set_grid_parameters_clamping(bool p_enabled) { + sb_off_x->set_allow_lesser(!p_enabled); + sb_off_x->set_allow_greater(!p_enabled); + sb_off_y->set_allow_lesser(!p_enabled); + sb_off_y->set_allow_greater(!p_enabled); + sb_step_x->set_allow_greater(!p_enabled); + sb_step_y->set_allow_greater(!p_enabled); + sb_sep_x->set_allow_greater(!p_enabled); + sb_sep_y->set_allow_greater(!p_enabled); +} + void TextureRegionEditor::_texture_overlay_input(const Ref<InputEvent> &p_input) { if (panner->gui_input(p_input)) { return; @@ -842,6 +856,7 @@ void TextureRegionEditor::_notification(int p_what) { } if (!is_visible()) { + EditorSettings::get_singleton()->set_project_metadata("texture_region_editor", "snap_offset", snap_offset); EditorSettings::get_singleton()->set_project_metadata("texture_region_editor", "snap_step", snap_step); EditorSettings::get_singleton()->set_project_metadata("texture_region_editor", "snap_separation", snap_separation); EditorSettings::get_singleton()->set_project_metadata("texture_region_editor", "snap_mode", snap_mode); @@ -973,6 +988,7 @@ void TextureRegionEditor::_texture_changed() { void TextureRegionEditor::_edit_region() { const Ref<Texture2D> object_texture = _get_edited_object_texture(); if (object_texture.is_null()) { + _set_grid_parameters_clamping(false); _zoom_reset(); hscroll->hide(); vscroll->hide(); @@ -1057,6 +1073,26 @@ void TextureRegionEditor::_edit_region() { } } + // Avoiding clamping with mismatched min/max. + _set_grid_parameters_clamping(false); + const Size2 tex_size = object_texture->get_size(); + sb_off_x->set_min(-tex_size.x); + sb_off_x->set_max(tex_size.x); + sb_off_y->set_min(-tex_size.y); + sb_off_y->set_max(tex_size.y); + sb_step_x->set_max(tex_size.x); + sb_step_y->set_max(tex_size.y); + sb_sep_x->set_max(tex_size.x); + sb_sep_y->set_max(tex_size.y); + + _set_grid_parameters_clamping(true); + sb_off_x->set_value(snap_offset.x); + sb_off_y->set_value(snap_offset.y); + sb_step_x->set_value(snap_step.x); + sb_step_y->set_value(snap_step.y); + sb_sep_x->set_value(snap_separation.x); + sb_sep_y->set_value(snap_separation.y); + _update_rect(); texture_preview->queue_redraw(); texture_overlay->queue_redraw(); @@ -1080,6 +1116,7 @@ TextureRegionEditor::TextureRegionEditor() { set_ok_button_text(TTR("Close")); // A power-of-two value works better as a default grid size. + snap_offset = EditorSettings::get_singleton()->get_project_metadata("texture_region_editor", "snap_offset", Vector2()); snap_step = EditorSettings::get_singleton()->get_project_metadata("texture_region_editor", "snap_step", Vector2(8, 8)); snap_separation = EditorSettings::get_singleton()->get_project_metadata("texture_region_editor", "snap_separation", Vector2()); snap_mode = (SnapMode)(int)EditorSettings::get_singleton()->get_project_metadata("texture_region_editor", "snap_mode", SNAP_NONE); @@ -1110,19 +1147,13 @@ TextureRegionEditor::TextureRegionEditor() { hb_grid->add_child(memnew(Label(TTR("Offset:")))); sb_off_x = memnew(SpinBox); - sb_off_x->set_min(-256); - sb_off_x->set_max(256); sb_off_x->set_step(1); - sb_off_x->set_value(snap_offset.x); sb_off_x->set_suffix("px"); sb_off_x->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_off_x)); hb_grid->add_child(sb_off_x); sb_off_y = memnew(SpinBox); - sb_off_y->set_min(-256); - sb_off_y->set_max(256); sb_off_y->set_step(1); - sb_off_y->set_value(snap_offset.y); sb_off_y->set_suffix("px"); sb_off_y->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_off_y)); hb_grid->add_child(sb_off_y); @@ -1131,19 +1162,15 @@ TextureRegionEditor::TextureRegionEditor() { hb_grid->add_child(memnew(Label(TTR("Step:")))); sb_step_x = memnew(SpinBox); - sb_step_x->set_min(-256); - sb_step_x->set_max(256); + sb_step_x->set_min(0); sb_step_x->set_step(1); - sb_step_x->set_value(snap_step.x); sb_step_x->set_suffix("px"); sb_step_x->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_step_x)); hb_grid->add_child(sb_step_x); sb_step_y = memnew(SpinBox); - sb_step_y->set_min(-256); - sb_step_y->set_max(256); + sb_step_y->set_min(0); sb_step_y->set_step(1); - sb_step_y->set_value(snap_step.y); sb_step_y->set_suffix("px"); sb_step_y->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_step_y)); hb_grid->add_child(sb_step_y); @@ -1153,24 +1180,29 @@ TextureRegionEditor::TextureRegionEditor() { sb_sep_x = memnew(SpinBox); sb_sep_x->set_min(0); - sb_sep_x->set_max(256); sb_sep_x->set_step(1); - sb_sep_x->set_value(snap_separation.x); sb_sep_x->set_suffix("px"); sb_sep_x->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_sep_x)); hb_grid->add_child(sb_sep_x); sb_sep_y = memnew(SpinBox); sb_sep_y->set_min(0); - sb_sep_y->set_max(256); sb_sep_y->set_step(1); - sb_sep_y->set_value(snap_separation.y); sb_sep_y->set_suffix("px"); sb_sep_y->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_sep_y)); hb_grid->add_child(sb_sep_y); hb_grid->hide(); + // Restore grid snap parameters. + _set_grid_parameters_clamping(false); + sb_off_x->set_value(snap_offset.x); + sb_off_y->set_value(snap_offset.y); + sb_step_x->set_value(snap_step.x); + sb_step_y->set_value(snap_step.y); + sb_sep_x->set_value(snap_separation.x); + sb_sep_y->set_value(snap_separation.y); + // Default the zoom to match the editor scale, but don't dezoom on editor scales below 100% to prevent pixel art from looking bad. draw_zoom = MAX(1.0f, EDSCALE); max_draw_zoom = 128.0f * MAX(1.0f, EDSCALE); diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h index fb2b547bed..59a1b56c19 100644 --- a/editor/plugins/texture_region_editor_plugin.h +++ b/editor/plugins/texture_region_editor_plugin.h @@ -31,18 +31,17 @@ #ifndef TEXTURE_REGION_EDITOR_PLUGIN_H #define TEXTURE_REGION_EDITOR_PLUGIN_H -#include "canvas_item_editor_plugin.h" #include "editor/editor_inspector.h" #include "editor/editor_plugin.h" -#include "scene/2d/sprite_2d.h" -#include "scene/3d/sprite_3d.h" #include "scene/gui/dialogs.h" -#include "scene/gui/nine_patch_rect.h" -#include "scene/resources/style_box_texture.h" class AtlasTexture; +class NinePatchRect; class OptionButton; class PanelContainer; +class Sprite2D; +class Sprite3D; +class StyleBoxTexture; class ViewPanner; class TextureRegionEditor : public AcceptDialog { @@ -138,6 +137,8 @@ class TextureRegionEditor : public AcceptDialog { void _draw_margin_line(Vector2 p_from, Vector2 p_to); + void _set_grid_parameters_clamping(bool p_enabled); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index df3c9631f9..105f4484b2 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -500,6 +500,13 @@ void TabContainer::_on_tab_visibility_changed(Control *p_child) { updating_visibility = false; } +void TabContainer::_refresh_tab_indices() { + Vector<Control *> controls = _get_tab_controls(); + for (int i = 0; i < controls.size(); i++) { + controls[i]->set_meta("_tab_index", i); + } +} + void TabContainer::_refresh_tab_names() { Vector<Control *> controls = _get_tab_controls(); for (int i = 0; i < controls.size(); i++) { @@ -523,6 +530,7 @@ void TabContainer::add_child_notify(Node *p_child) { c->hide(); tab_bar->add_tab(p_child->get_name()); + c->set_meta("_tab_index", tab_bar->get_tab_count() - 1); _update_margins(); if (get_tab_count() == 1) { @@ -547,19 +555,10 @@ 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 = 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++) { - if (get_tab_title(i) == tab_name) { - old_idx = i; - break; - } - } - - tab_bar->move_tab(old_idx, get_tab_idx_from_control(c)); + tab_bar->move_tab(c->get_meta("_tab_index"), get_tab_idx_from_control(c)); } + + _refresh_tab_indices(); } void TabContainer::remove_child_notify(Node *p_child) { @@ -578,7 +577,10 @@ void TabContainer::remove_child_notify(Node *p_child) { // As the child hasn't been removed yet, keep track of it so when the "tab_changed" signal is fired it can be ignored. children_removing.push_back(c); + tab_bar->remove_tab(idx); + _refresh_tab_indices(); + children_removing.erase(c); _update_margins(); @@ -586,6 +588,7 @@ void TabContainer::remove_child_notify(Node *p_child) { queue_redraw(); } + p_child->remove_meta("_tab_index"); p_child->remove_meta("_tab_name"); p_child->disconnect("renamed", callable_mp(this, &TabContainer::_refresh_tab_names)); p_child->disconnect(SNAME("visibility_changed"), callable_mp(this, &TabContainer::_on_tab_visibility_changed)); diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h index 03eff5d944..8645a6d14e 100644 --- a/scene/gui/tab_container.h +++ b/scene/gui/tab_container.h @@ -101,6 +101,7 @@ private: Vector<Control *> _get_tab_controls() const; void _on_theme_changed(); void _repaint(); + void _refresh_tab_indices(); void _refresh_tab_names(); void _update_margins(); void _on_mouse_exited(); diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp index 00291d2ac4..2b6644e893 100644 --- a/servers/rendering/rendering_device.cpp +++ b/servers/rendering/rendering_device.cpp @@ -5554,6 +5554,7 @@ void RenderingDevice::_bind_methods() { ClassDB::bind_method(D_METHOD("compute_list_set_push_constant", "compute_list", "buffer", "size_bytes"), &RenderingDevice::_compute_list_set_push_constant); ClassDB::bind_method(D_METHOD("compute_list_bind_uniform_set", "compute_list", "uniform_set", "set_index"), &RenderingDevice::compute_list_bind_uniform_set); ClassDB::bind_method(D_METHOD("compute_list_dispatch", "compute_list", "x_groups", "y_groups", "z_groups"), &RenderingDevice::compute_list_dispatch); + ClassDB::bind_method(D_METHOD("compute_list_dispatch_indirect", "compute_list", "buffer", "offset"), &RenderingDevice::compute_list_dispatch_indirect); ClassDB::bind_method(D_METHOD("compute_list_add_barrier", "compute_list"), &RenderingDevice::compute_list_add_barrier); ClassDB::bind_method(D_METHOD("compute_list_end"), &RenderingDevice::compute_list_end); |