Skip to content

Commit

Permalink
Merge branch 'godotengine:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Norrox authored Jan 22, 2025
2 parents 8ec6545 + a7146ef commit 1f8f6f3
Show file tree
Hide file tree
Showing 33 changed files with 810 additions and 216 deletions.
7 changes: 7 additions & 0 deletions doc/classes/CollisionPolygon3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
<tutorials>
</tutorials>
<members>
<member name="debug_color" type="Color" setter="set_debug_color" getter="get_debug_color" default="Color(0, 0, 0, 0)">
The collision shape color that is displayed in the editor, or in the running project if [b]Debug &gt; Visible Collision Shapes[/b] is checked at the top of the editor.
[b]Note:[/b] The default value is [member ProjectSettings.debug/shapes/collision/shape_color]. The [code]Color(0, 0, 0, 0)[/code] value documented here is a placeholder, and not the actual default debug color.
</member>
<member name="debug_fill" type="bool" setter="set_enable_debug_fill" getter="get_enable_debug_fill" default="true">
If [code]true[/code], when the shape is displayed, it will show a solid fill color in addition to its wireframe.
</member>
<member name="depth" type="float" setter="set_depth" getter="get_depth" default="1.0">
Length that the resulting collision extends in either direction perpendicular to its 2D polygon.
</member>
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3024,7 +3024,7 @@ bool EditorFileSystem::_copy_directory(const String &p_from, const String &p_to,
for (String F = old_dir->_get_next(); !F.is_empty(); F = old_dir->_get_next()) {
if (old_dir->current_is_dir()) {
success = _copy_directory(p_from.path_join(F), p_to.path_join(F), p_files) && success;
} else if (F.get_extension() != "import") {
} else if (F.get_extension() != "import" && F.get_extension() != "uid") {
CopiedFile copy;
copy.from = p_from.path_join(F);
copy.to = p_to.path_join(F);
Expand Down
20 changes: 12 additions & 8 deletions editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2599,18 +2599,24 @@ void EditorPropertyColor::_color_changed(const Color &p_color) {
get_edited_object()->set(get_edited_property(), p_color);
}

void EditorPropertyColor::_picker_created() {
picker->get_popup()->connect("about_to_popup", callable_mp(this, &EditorPropertyColor::_popup_opening));
picker->connect("popup_closed", callable_mp(this, &EditorPropertyColor::_popup_closed), CONNECT_DEFERRED);
}

void EditorPropertyColor::_popup_opening() {
EditorNode::get_singleton()->setup_color_picker(picker->get_picker());
last_color = picker->get_pick_color();
was_checked = !is_checkable() || is_checked();
}

void EditorPropertyColor::_popup_closed() {
get_edited_object()->set(get_edited_property(), was_checked ? Variant(last_color) : Variant());
if (!picker->get_pick_color().is_equal_approx(last_color)) {
emit_changed(get_edited_property(), picker->get_pick_color(), "", false);
}
}

void EditorPropertyColor::_picker_opening() {
last_color = picker->get_pick_color();
was_checked = !is_checkable() || is_checked();
}

void EditorPropertyColor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
Expand Down Expand Up @@ -2654,9 +2660,7 @@ EditorPropertyColor::EditorPropertyColor() {
add_child(picker);
picker->set_flat(true);
picker->connect("color_changed", callable_mp(this, &EditorPropertyColor::_color_changed));
picker->connect("popup_closed", callable_mp(this, &EditorPropertyColor::_popup_closed), CONNECT_DEFERRED);
picker->get_popup()->connect("about_to_popup", callable_mp(EditorNode::get_singleton(), &EditorNode::setup_color_picker).bind(picker->get_picker()));
picker->get_popup()->connect("about_to_popup", callable_mp(this, &EditorPropertyColor::_picker_opening));
picker->connect("picker_created", callable_mp(this, &EditorPropertyColor::_picker_created), CONNECT_ONE_SHOT);
}

////////////// NODE PATH //////////////////////
Expand Down
3 changes: 2 additions & 1 deletion editor/editor_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,9 @@ class EditorPropertyColor : public EditorProperty {
GDCLASS(EditorPropertyColor, EditorProperty);
ColorPickerButton *picker = nullptr;
void _color_changed(const Color &p_color);
void _picker_created();
void _popup_opening();
void _popup_closed();
void _picker_opening();

Color last_color;
bool live_changes_enabled = true;
Expand Down
2 changes: 2 additions & 0 deletions editor/editor_run_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ Error EditorRunNative::start_run_native(int p_id) {
}
run_confirmed = false;

preset->update_value_overrides();

emit_signal(SNAME("native_run"), preset);

BitField<EditorExportPlatform::DebugFlags> flags = 0;
Expand Down
72 changes: 70 additions & 2 deletions editor/gui/editor_bottom_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,27 @@
#include "editor/themes/editor_scale.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/split_container.h"

void EditorBottomPanel::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
pin_button->set_button_icon(get_editor_theme_icon(SNAME("Pin")));
expand_button->set_button_icon(get_editor_theme_icon(SNAME("ExpandBottomDock")));
left_button->set_button_icon(get_editor_theme_icon(SNAME("Back")));
right_button->set_button_icon(get_editor_theme_icon(SNAME("Forward")));
} break;

case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
if (is_layout_rtl()) {
bottom_hbox->move_child(left_button, button_scroll->get_index() + 1);
bottom_hbox->move_child(right_button, 0);
} else {
bottom_hbox->move_child(right_button, button_scroll->get_index() + 1);
bottom_hbox->move_child(left_button, 0);
}
} break;
}
}
Expand All @@ -59,6 +73,33 @@ void EditorBottomPanel::_switch_by_control(bool p_visible, Control *p_control, b
}
}

void EditorBottomPanel::_scroll(bool p_right) {
HScrollBar *h_scroll = button_scroll->get_h_scroll_bar();
if (Input::get_singleton()->is_key_pressed(Key::CTRL)) {
h_scroll->set_value(p_right ? h_scroll->get_max() : 0);
} else if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * (p_right ? 1 : -1));
} else {
h_scroll->set_value(h_scroll->get_value() + (h_scroll->get_page() * 0.5) * (p_right ? 1 : -1));
}
}

void EditorBottomPanel::_update_scroll_buttons() {
bool show_arrows = button_hbox->get_size().width > button_scroll->get_size().width;
left_button->set_visible(show_arrows);
right_button->set_visible(show_arrows);

if (show_arrows) {
_update_disabled_buttons();
}
}

void EditorBottomPanel::_update_disabled_buttons() {
HScrollBar *h_scroll = button_scroll->get_h_scroll_bar();
left_button->set_disabled(h_scroll->get_value() == 0);
right_button->set_disabled(h_scroll->get_value() + h_scroll->get_page() == h_scroll->get_max());
}

void EditorBottomPanel::_switch_to_item(bool p_visible, int p_idx, bool p_ignore_lock) {
ERR_FAIL_INDEX(p_idx, items.size());

Expand Down Expand Up @@ -93,6 +134,7 @@ void EditorBottomPanel::_switch_to_item(bool p_visible, int p_idx, bool p_ignore
if (expand_button->is_pressed()) {
EditorNode::get_top_split()->hide();
}
callable_mp(button_scroll, &ScrollContainer::ensure_control_visible).call_deferred(items[p_idx].button);
} else {
add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles)));
items[p_idx].button->set_pressed_no_signal(false);
Expand Down Expand Up @@ -259,9 +301,35 @@ EditorBottomPanel::EditorBottomPanel() {
bottom_hbox->set_custom_minimum_size(Size2(0, 24 * EDSCALE)); // Adjust for the height of the "Expand Bottom Dock" icon.
item_vbox->add_child(bottom_hbox);

left_button = memnew(Button);
left_button->set_tooltip_text(TTR("Scroll Left\nHold Ctrl to scroll to the begin.\nHold Shift to scroll one page."));
left_button->set_theme_type_variation("BottomPanelButton");
left_button->set_focus_mode(Control::FOCUS_NONE);
left_button->connect(SceneStringName(pressed), callable_mp(this, &EditorBottomPanel::_scroll).bind(false));
bottom_hbox->add_child(left_button);
left_button->hide();

button_scroll = memnew(ScrollContainer);
button_scroll->set_h_size_flags(Control::SIZE_EXPAND_FILL);
button_scroll->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_SHOW_NEVER);
button_scroll->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
button_scroll->get_h_scroll_bar()->connect(CoreStringName(changed), callable_mp(this, &EditorBottomPanel::_update_scroll_buttons), CONNECT_DEFERRED);
button_scroll->get_h_scroll_bar()->connect(SceneStringName(value_changed), callable_mp(this, &EditorBottomPanel::_update_disabled_buttons).unbind(1), CONNECT_DEFERRED);
bottom_hbox->add_child(button_scroll);

right_button = memnew(Button);
right_button->set_tooltip_text(TTR("Scroll Right\nHold Ctrl to scroll to the end.\nHold Shift to scroll one page."));
right_button->set_theme_type_variation("BottomPanelButton");
right_button->set_focus_mode(Control::FOCUS_NONE);
right_button->connect(SceneStringName(pressed), callable_mp(this, &EditorBottomPanel::_scroll).bind(true));
bottom_hbox->add_child(right_button);
right_button->hide();

callable_mp(this, &EditorBottomPanel::_update_scroll_buttons).call_deferred();

button_hbox = memnew(HBoxContainer);
button_hbox->set_h_size_flags(Control::SIZE_EXPAND_FILL);
bottom_hbox->add_child(button_hbox);
button_hbox->set_h_size_flags(Control::SIZE_EXPAND | Control::SIZE_SHRINK_BEGIN);
button_scroll->add_child(button_hbox);

editor_toaster = memnew(EditorToaster);
bottom_hbox->add_child(editor_toaster);
Expand Down
7 changes: 7 additions & 0 deletions editor/gui/editor_bottom_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ConfigFile;
class EditorToaster;
class HBoxContainer;
class VBoxContainer;
class ScrollContainer;

class EditorBottomPanel : public PanelContainer {
GDCLASS(EditorBottomPanel, PanelContainer);
Expand All @@ -53,6 +54,9 @@ class EditorBottomPanel : public PanelContainer {

VBoxContainer *item_vbox = nullptr;
HBoxContainer *bottom_hbox = nullptr;
Button *left_button = nullptr;
Button *right_button = nullptr;
ScrollContainer *button_scroll = nullptr;
HBoxContainer *button_hbox = nullptr;
EditorToaster *editor_toaster = nullptr;
Button *pin_button = nullptr;
Expand All @@ -63,6 +67,9 @@ class EditorBottomPanel : public PanelContainer {
void _switch_to_item(bool p_visible, int p_idx, bool p_ignore_lock = false);
void _pin_button_toggled(bool p_pressed);
void _expand_button_toggled(bool p_pressed);
void _scroll(bool p_right);
void _update_scroll_buttons();
void _update_disabled_buttons();

bool _button_drag_hover(const Vector2 &, const Variant &, Button *p_button, Control *p_control);

Expand Down
Loading

0 comments on commit 1f8f6f3

Please sign in to comment.